home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / Libraries / SAT 2.3b4 / Tutorial ƒ / Assignment3.p < prev    next >
Text File  |  1995-01-16  |  761b  |  39 lines

  1. program Assignment3;
  2.     uses
  3. {$ifc UNDEFINED THINK_PASCAL}
  4.         Types, QuickDraw, Menus, Windows, TextEdit, Fonts, Dialogs, Memory, OSEvents, {}
  5. {$endc}
  6.         SAT;
  7.  
  8.     var
  9.         ignore: SpritePtr;
  10.  
  11.     var
  12.         direction: Integer;
  13.  
  14.     procedure HandleSprite (me: SpritePtr);
  15.     begin
  16.         me^.position.h := me^.position.h + direction;
  17.         if me^.position.h <= 0 then
  18.             direction := 1;
  19.         if me^.position.h >= 200 then
  20.             direction := -1;
  21.     end; {HandleSprite}
  22.  
  23.     procedure SetupSprite (me: SpritePtr);
  24.     begin
  25.         me^.task := @HandleSprite;
  26.         me^.face := SATGetFace(128);
  27.         direction := 1;
  28.     end; {SetupSprite}
  29.  
  30. begin
  31. {$ifc UNDEFINED THINK_PASCAL}
  32.     SATInitToolbox;
  33. {$endc}
  34.  
  35.     SATInit(128, 129, 478, 302);
  36.     ignore := SATNewSprite(0, 200, 200, @SetupSprite);
  37.     while not Button do
  38.         SATRun(true);
  39. end.